package com.farmUni.intercepter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

// 全局拦截器
@Configuration
@Slf4j

public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        log.info("我开始拦截了");
        registry.addInterceptor(new JwtInterceptor())
                // 不拦截Login接口，剩余接口都拦截
                .excludePathPatterns("/login")
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/user/login2")
                .excludePathPatterns("/**/common/*")
                .excludePathPatterns("/carousel/**")
                .excludePathPatterns("/picture/**")
                .excludePathPatterns("/icon/**")
                .excludePathPatterns("/viewRec/**")
                .excludePathPatterns("/foodRec/**")
//                .excludePathPatterns("/article/user/getShowList")
                .excludePathPatterns("/article/getCultureOrImpressRec")
        ;

    }
}